package com.example.jsonquynh;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;

public class MenuSetting extends SlidingMenu implements OnItemClickListener {
	private Context context;

	public MenuSetting(Context context) {
		super(context); 
		this.context = context;
		setMode(SlidingMenu.LEFT);
		setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
		setBehindOffsetRes(R.dimen.slidingmenu_offset);
		setFadeDegree(0.35f);
		attachToActivity((Activity) context, SlidingMenu.SLIDING_CONTENT);
		setMenu(R.layout.menu_frame);
		ListView menusetting = (ListView) findViewById(R.id.lvMenu_setting);
		menusetting.setOnItemClickListener(this);
	}

	@Override
	public void onItemClick(AdapterView<?> andapter, View view, int index,
			long arg3) {
		switch (index) {
		case 0:
			Intent i = new Intent();
			i.setClass(context, MainActivity.class);
			i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
			context.startActivity(i);
			break;
		case 1:
			i = new Intent();
			i.setClass(context, Favorite.class);
			i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
			context.startActivity(i);
			break;
		}

	}

}
